/**
 * Definition for singly-linked list.
 * function ListNode(val) {
 *     this.val = val;
 *     this.next = null;
 * }
 */
/**
 * @param {ListNode} head
 * @return {number[]}
 */
// 利用栈的先进后出来实现
var reversePrint = function (head) {
	// 1. 创建用于储存的链表
	let arr = [];
	let node = head;
	while (node !== null) {
		arr.unshift(node.val);
		node = node.next;
	}
	return arr;
};